<#--<%@ page contentType="text/html;charset=UTF-8" language="java" %>-->
<#--<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>角色管理</title>
   <#include "../common/link.ftl">

</head>
<body class="hold-transition skin-blue sidebar-mini">

<div class="wrapper">
    <#include "../common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="role">
    <#--<c:set var="currentMenu" value="role"/>-->
    <#include "../common/menu.ftl">

    <div class="content-wrapper">
        <section class="content-header">
            <h1>角色管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <div style="margin: 10px;">
                    <!--高级查询--->
                    <form class="form-inline" id="searchForm" action="/role/list.do" method="post">
                        <input type="hidden" name="currentPage" id="currentPage" value="1">
                        <a href="/role/input.do" class="btn btn-success btn_redirect"><span class="glyphicon glyphicon-plus"></span> 添加</a>
                    </form>

                    <table class="table table-striped table-hover" >
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>角色名称</th>
                            <th>角色编号</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <#list (pageResult.list)! as role>
                        <#--<c:forEach items="${pageResult.data}" var="role" varStatus="vs">-->
                           <tr>
                               <td>${role_index+1}</td>
                               <td>${role.name}</td>
                               <td>${role.sn}</td>
                               <td>
                                   <a href="/role/input.do?id=${role.id}" class="btn btn-info btn-xs btn_redirect">
                                       <span class="glyphicon glyphicon-pencil"></span> 编辑
                                   </a>
                                   <a href="#" data-did="${role.id}" class="btn btn-danger btn-xs btn_delete" >
                                       <span class="glyphicon glyphicon-trash"></span> 删除
                                   </a>
                               </td>
                           </tr>
                        </#list>
                    </table>

                    <#--<%-- 删除确认框 --%>-->
                    <script>
                        $('.btn_delete').click(function () {
                            var $did3 = $(this).data('did');
                            //修改确认框的文本
                            $.messager.model = {ok: {text: '确认'}, cancel: {text: '取消'}}
                            $.messager.confirm('警告', '是否确认删除?', function () {
                                //点击确定后的回调函数
                                //window.location.href = "/employee/delete.do?id=" + $did3
                                $.get("/role/delete.do?id="+$did3,function (data) {
                                    if(data.success){
                                        alert(data.msg)
                                        window.location.reload()
                                    }else{
                                        alert(data.msg)
                                    }
                                })
                                console.log('you closed it');
                            });
                        });
                    </script>


                    <!--分页-->
                    <#include "../common/page.ftl">
                </div>
            </div>
        </section>
    </div>
    <#include "../common/footer.ftl">
</div>
</body>
</html>
